{include file="public/head"/} 
<style>
  #click{
    width:100%;
    height:100%;
    background-color: rgba(0,0,0,0.5);
    position:fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: none;

  }
</style>
  <body>
    <div id="click" onclick="aa()" ></div>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">后台管理</a>
        <a href="">人员信息管理中心</a>
        <a><cite>人员管理</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="javascript:location.reload()" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
          <form class="layui-form layui-col-md12 x-so"  method="get" action="#">
            <input class="layui-input" placeholder="部门" name="department" value="{if isset($department)}{$department}{/if}">
            <input class="layui-input" placeholder="住址" name="address" value="{if isset($address)}{$address}{/if}">
            
            <input class="layui-input" placeholder="姓名" name="name" value="{if isset($name)}{$name}{/if}">
            <input class="layui-input" placeholder="手机号" name="phone" value="{if isset($phone)}{$phone}{/if}">
            
            
            
            <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
          </form>
      </div>
      <xblock>
      <button class="layui-btn " onclick="x_admin_show('企业员工添加','{:url('staffcompanyadd')}',600,600)"><i class="layui-icon"></i>企业员工添加</button>
        <span class="x-right" style="line-height:40px">共有数据：{$number} 条</span>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>小区</th>
            <th>房号</th>
            <th>关系</th>
            <th>姓名</th>
            <th>部门</th>
            <th>手机号</th>
            
            <th>身份证</th>
            <th>时间</th>
            <th>注册状态</th>
            <th>健康码</th>
            <th>操作</th> 
          </tr>
        </thead>
        <tbody>
          {foreach $list as $lis}
          <tr style="height:80px">
            <td>{$lis.community_name}</td>
            <td>{$lis.address}</td>
            <td>
              {if $lis.relation == 0}
              业主
              {elseif $lis.relation == 1}
              家属
              {elseif $lis.relation == 2}
              租户
              {elseif $lis.relation == 3}
              访客
              {elseif $lis.relation == 4}
              企业员工
              {elseif $lis.relation == 5}
              物业员工
              {/if}
            </td>
            
            <td>{$lis.name}</td>
            <td>{$lis.department}</td>
            <td>{$lis.phone}</td>
            
           
            <td>{$lis.idcard}</td>
            
            <td>{$lis.ctime}</td>
            <td>
              {if $lis.ryid == "0"}
              未注册
              {/if}
              {if $lis.ryid != "0"}
              已注册
              {/if}
             
               
            </td>
            <td>
              {if $lis.mzt==="绿码"} <img src="static/index/images/green.png" style="width:60px;height:60px">{/if}
              {if $lis.mzt==="黄码"}<img src="static/index/images/yellow.png" style="width:60px;height:60px">{/if}
              {if $lis.mzt==="红码"}<img src="static/index/images/red.png" style="width:60px;height:60px">{/if}
            </td>
            <td class="td-manage">
              {if $lis.ryid == "0"}
              <input type="button" value="注册" style="cursor: pointer;height:30px;width:50px;border-radius: 5px" onclick="reg('{$lis.id}')" />
              {/if}
              {if $lis.ryid !== "0"}
              <input type="button" value="查询健康码" style="cursor: pointer;height:30px;width:80px;border-radius: 5px" onclick="x_admin_show('查询健康码','{:url('getJkmztByRyid')}?id={$lis.id}',600,600)" />
              {/if}
              <input type="button" value="删除" style="cursor: pointer;height:30px;width:50px;border-radius: 5px" onclick="ufacedel('{$lis.id}')" />
             
            </td> 
          </tr>
          {/foreach}
        </tbody>
      </table>
      <div class="page">
        <div>
            {$personnellist->render()}
        </div>
      </div>

    </div>
    <script>
        function cam(id){
            var url = "{:url('cam')}?&id=" + id;
            layer.open({
                type: 2,
                title: '拍照',
                shadeClose: true,
                shade: 0.8,
                area: ['90%', '90%'],
                content: url //iframe的url
            });
        } 
        function personnelEdit(id){
            var url = "{:url('personnelEdit')}?id=" + id;
            layer.open({
                type: 2,
                title: '人员编辑',
                shadeClose: true,
                shade: 0.8,
                area: ['90%', '90%'],
                content: url //iframe的url
            });
        }
    </script>
  <script>
      let a = document.getElementById("click")
      function mag(url){
          // console.log(123)

          a.style = "display:inline-block;"
          let b = `<img src="`+url+`" style="margin-left:20%;text-align:center">`
          a.innerHTML=b
      }
      function aa() {
          a.style = "display:none;"
      }


    //注册
    function reg(id, doc){
      if(confirm('确定要注册吗?')){ 
            var url = "{:url('sfrz1')}?id=" + id;
            layer.open({
                type: 2,
                title: '健康码注册',
                shadeClose: true,
                shade: 0.8,
                area: ['40%', '40%'],
                content: url, //iframe的url
                end:function () {
                    location.reload()
                }
            });
        }
        return false; 
    }   

    //删除
    function ufacedel(id, doc){
      if(confirm('确定要删除吗?')) 
      { 
        var url = "{:url('ufacedel')}?id=" + id
         window.location.href=url
        // console.log(url)
        //$('#' + doc).attr('href', url)
      } 
        return false; 
    }   
    function ufaceEdit(id){
      
      var url = "{:url('ufaceEdit')}?id=" + id
      window.location.href=url
      
    }
  </script>
    <script>
        layui.use(['form'], function() {
            var form = layui.form
            
            form.on('select(building)', function(f){
               

                var url = "{:url('room/getdata')}"
                $.post(url, {building: f.value,type: 1}, function(data) {
                $('#unit').html("")
                var option = "<option value=''>所有单元</option>"
                $('#unit').append(option)
                for (var i = 0; i < data.length; i++) {
                    option = "<option value='" + data[i] + "'>" + data[i] + "单元</option>"
                    $('#unit').append(option)
                }
                $('#building').data('building', f.value)
                form.render('select')
                })
            })
    
            form.on('select(unit)', function(f){
              
                var data_building = $('#building').data('building')
                var get_building = "<?php if (isset($building)) { echo $building;}?>"
                var building = typeof data_building === 'undefined' ? get_building : data_building
        
                var url = "{:url('room/getdata')}"
                $.post(url, {unit: f.value,  building: building, type: 2}, function(data) {
                $('#room').html("")
                var option = "<option value=''>所有房间</option>"
                $('#room').append(option)
                for (var i = 0; i < data.length; i++) {
                    option = "<option value='" + data[i] + "'>" + data[i] + "室</option>"
                    $('#room').append(option)
                }
                $('#unit').data('unit', f.value)
                form.render('select')
                })
            })
    
        })
    </script>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
  </body>

</html>